import request from '@/utils/request'

export const sendPhoneCode = function(phoneNo){
  return  request({
        url: '/sendLoginVerifyCode?phoneNo='+phoneNo,
        method: 'post'
    })
}

export const pwdLogin = function(param){
    return request({
        url: '/user/login',
        method: 'post',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        },
        data: param
    })
}

export const phoneNoLogin = function(param){
    return request({
        url: '/mobile/login',
        method: 'post',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        },
        data: param
    })
}

export const getUerInfo  = function(){
    return request({
        url: '/userInfo',
        method: 'get'
    })
}

export const getMenusByRoleId = function(roleId){
    return request({
        url: `/menu/list/${roleId}`,
        method: 'get',
        headers: {
            'Content-Type': 'application/json'
        }
    })
}

export const userLogout = function(){
    return request({
        url: '/user/logout',
        method: 'post',
        headers: {
            'Content-Type': 'application/json'
        }
    })
}